1. Field of the Invention
The present invention relates to a microcomputer comprising an A/D converter and capable of detecting whether the result of conversion by the A/D converter increases or decreases.
2. Description of the Prior Art
FIG. 7 is a schematic diagram of the configuration of a microcomputer comprising a conventional A/D converter. For simplification, a 2-bit A/D converter is shown here. In the figure, reference symbol 1A represents a CPU, 1B an A/D converter, 10 a low-order bit data line of the conversion result of the A/D converter 1B, 11 a high-order bit data line of the conversion result of the A/D converter, 13 a tri-state buffer, 14 a system bus and 15 a latch. As shown in FIG. 8, when T is at "H", data inputted from D is inputted into the latch 15 which keeps the data latched while T remains at "L" and outputs the inverted data of the data latched by Q to Q. Reference numeral 16 represents A/D conversion result storage means which consists of two units of the latch 15 for storing the above-mentioned low-order and high-order bit data, that is the conversion result of the A/D converter 1B, R3 a read signal which becomes active when it reads the contents of this A/D conversion result storage means for output to the system bus 14, and T5 a signal indicative of the completion of A/D conversion by the A/D converter 1B which is also active at "H".
The operation of the microcomputer will be explained hereafter. When the A/D conversion operation of the A/D converter 1B is completed, the A/D conversion complete signal T5 becomes active ("H"), and the result of A/D conversion is stored in the storage means 16 for storing the result of A/D conversion. The contents of the result can be read and outputted to the system bus 14 through the tri-state buffer 13 by the R3 signal.
Since the microcomputer comprising the conventional A/D converter is structured as described above, the microcomputer does not have means for detecting whether the result of A/D conversion increases or decreases with the passage of time. However, for its application, correction control (for instance, compensation for the influence of a superimposed direct current when the amount of an alternating current is sampled for digital conversion) is performed according to an increase or decrease in analog voltage. Furthermore, according to whether an absolute value of a change is abnormal or not, the step goes to an exception process (in the above case, supposing that the amount of the alternating current is a sine wave, data on the next input amount predicted from the current input amount and the previous input amount is compared with the actual next input amount. When there is a difference between them, it is determined that the amount of the alternating current is abnormal, and the step enters a program processing routine). These processes are controlled by software. If this processing of this important data obtained from the A/D converter is performed by a conventional A/D converter, a large overhead (longer processing time and a greater load on the CPU 1A) occurs on the processing of data such as data saving and arithmetic operation, thus making difficult high-speed and advanced control.